home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / docs / hdtech01.txt < prev    next >
Internet Message Format  |  1995-03-26  |  14KB

  1. From: datarec@inforamp.net (Nicholas Majors)
  2. Subject: Chapter 1 - Technicians' Guide to Hard Disks (REPOST)
  3. Date: 25 Mar 1995 18:45:09 GMT
  4.  
  5.  
  6. ========================================================================
  7.      Chapter 1 - TECHNICIANS' GUIDE TO PC HARD DISK SUBSYSTEMS
  8. ========================================================================
  9. copyright (c) 1992, 1995
  10.  
  11. Nicholas Majors,
  12.  
  13. DATA RECOVERY LABS
  14. (division of Data Recovery Services Inc)    Voice : 1-416-510-6990
  15. 1315 Lawrence Avenue East - Unit 502        FAX   : 1-416-510-6992
  16. Don Mills, Ontario, Canada M3A 3R3          Email : datarec@the-wire.com
  17. ========================================================================
  18.  
  19. INTRODUCTION : 
  20.  
  21. This booklet (now electronic) is published as a service of Data 
  22. Recovery Labs.  Its purpose is to provide the fundamental knowledge of 
  23. concepts and terminology that is necessary to deal with the 
  24. complexities of hard disk subsystems.  It is not a technical reference 
  25. guide and should not replace original documentation made available by 
  26. manufacturers.
  27.  
  28. Every day we meet and deal with technicians and support personnel who 
  29. install, upgrade and maintain hard drives, without knowing exactly 
  30. what they are and how they work.  Gaining a working knowledge of disk 
  31. subsystems is not a simple task and requires much study - and - 
  32. experience.  Don't expect any book, training course, or manual to make 
  33. you into an expert. However, if you read and understand most of this 
  34. material, you will be off to a fine start.
  35.  
  36. The principal author is Nick Majors.  He has been in the industry 
  37. since 1979, designing and developing hardware and operating system 
  38. enhancements and performance tools.  He is an experienced machine 
  39. language programmer and has provided technical training to support 
  40. personnel for some of Canada's leading banks, corporations, government 
  41. departments and PC service organizations.  He is Manager of Technical 
  42. Services for Data Recovery Labs which he founded in 1989.
  43.  
  44. While this booklet deals primarily with PC and PC compatible 
  45. platforms, there is much information to benefit support personnel with 
  46. other hardware platforms. 
  47.  
  48. Every effort has been made to ensure accuracy, but misprints and 
  49. ambiguities may still remain, so please use caution.
  50.  
  51. ========================================================================
  52. HISTORY AND OVERVIEW :
  53.  
  54. The original IBM PC, introduced in 1981, did not support any type of 
  55. hard drive.  Program code in the BIOS did not recognize any such 
  56. device and early versions of DOS precluded mass storage by limiting 
  57. the maximum number of directory entries.  This is not surprising when 
  58. you consider that the original 4.77 MHz PC came with 16 K of RAM, 
  59. expandable to 64 K on the motherboard.  Even floppy drives and a disk 
  60. operating system were options to upgrade the built in cassette 
  61. recorder port and ROM basic.
  62.  
  63. To utilize a hard drive in a PC requires:
  64.    
  65.    - a Hardware IRQ (interrupt request)
  66.    - I/O port addresses for the controller
  67.    - a DMA channel (now optional)
  68.    - low level program code
  69.    - a physical interface to the bus (expansion slot or built-in)
  70.    - operating system support
  71.    - sufficient power and cooling
  72.  
  73. After DOS 2 introduced the sub-directory system and support for mass 
  74. storage devices, companies started selling hard drives for the PC. 
  75. These were external cabinets that contained the disk itself, a 
  76. controller card, and a dedicated power supply (since the PC's 63.5 watts 
  77. were insufficient).  Migrating from other architectures, these units 
  78. connected to the PC through cabling to an 8 bit adapter card that 
  79. plugged into an available expansion slot. These subsystems were 
  80. configured to use one of the available IRQ's, DMA channels, a range of 
  81. I/O ports, and program code that was made available through a device 
  82. driver loaded into memory after startup (booting from a floppy).
  83.  
  84. In 1983, the IBM XT (eXTended) was unveiled with its built-in 10 MB 
  85. fixed disk. IBM worked with a company (Xebec, I think) to take the 
  86. controller components normally located in the external cabinet and 
  87. build them right onto a bus interface card, creating what we commonly 
  88. call the "hard disk controller".
  89.  
  90. Program code was provided by a ROM chip on the controller card which 
  91. supplemented subroutines in the BIOS, and the internal power supply 
  92. was upgraded to 135 watts to provide power for the internally mounted 
  93. drive.
  94.  
  95. The XT design utilized :
  96.  
  97.    - IRQ 5
  98.    - I/O port addresses 320-32f
  99.    - DMA channel 3
  100.    - Program Code from adapter ROM at c8000
  101.    - DOS 2.0 or higher
  102.  
  103. Several companies started manufacturing and selling similar 
  104. drive/controller packages with various improvements including higher 
  105. capacities, superior performance and built-in floppy controller 
  106. components on the same card (to save an expansion slot). These third 
  107. party subsystems could even be added to an original PC, so long as the 
  108. internal power supply was also upgraded.
  109.  
  110. In 1984, the IBM AT (Advanced Technology) brought a complete overhaul 
  111. to hard disk systems. Program code was included in the motherboard ROM 
  112. BIOS, eliminating the need for a ROM chip on the new 16 bit controller 
  113. card, and a higher quality drive improved access times. The system 
  114. included use of newly added higher IRQ's, eliminated the use of DMA 
  115. for hard drives, and changed the range of I/O addresses. 
  116.  
  117. The AT design utilized :
  118.  
  119.    - IRQ 14
  120.    - I/O port addresses 1f0-1f8
  121.    - DMA channel - none
  122.    - Program Code from motherboard ROM BIOS
  123.    - DOS 2.0 or higher
  124.  
  125. Hardware configuration details for the AT, including hard disk 
  126. parameters, were stored in a low power CMOS chip connected to a small 
  127. battery, eliminating many of the motherboard configuration dip 
  128. switches and jumpers.  The battery allowed information to be 
  129. maintained while the computer was turned off and information could be 
  130. changed by running a setup program from disk.
  131.  
  132. The original AT supported 14 different drive types, recognizing 
  133. specific hard disks ranging from 10 to 112 MB.  Any drive with 
  134. physical parameters that did not match one of these types needed a ROM 
  135. extension on the controller card or a device driver loaded during 
  136. boot-up.
  137.  
  138. DOS versions prior to 4.0 (or 3.31) did not support partitions larger 
  139. than 32 MB no matter how big a drive was.  This was because of sector 
  140. numbering that could not exceed 16 bit values (up to 65,536 sectors).  
  141. To make a larger partition required the use of special software like 
  142. Ontrack's Disk Manager.  This software was so popular that many drive 
  143. manufacturers shipped it with their product.  Unfortunately, while 
  144. this offered one of the better solutions, it did pose compatibility 
  145. problems for many disk utilities because, in effect, you had a non-DOS 
  146. partition.
  147.  
  148. Many people opted instead to divide their drives into 32 MB partitions 
  149. creating a C: D: E: etc. up to the physical capacity.  Prior to DOS 
  150. 3.3, even this was not possible, because DOS did not recognize 
  151. extended partitions!
  152.  
  153. The number of drive types supported by CMOS has expanded to over 40 
  154. and most current BIOS's provide a user definable type to allow 
  155. parameters to match any drive. Most PC's today still rely on this 
  156. original CMOS drive type scheme to configure and control hard disks, 
  157. though many architectures and BIOS's have changed how the information 
  158. is stored and updated.
  159.  
  160. This inherently creates certain limiting factors, including a problem 
  161. with more than two hard drives and BIOS/OS limits to recognizing more 
  162. than 1024 cylinders, 16 heads and 63 sectors per track.   Various 
  163. technologies must be used to translate non-compliant physical 
  164. geometries into logical parameters recognized by the system to 
  165. maintain compatibility with operating system and utility programs that 
  166. are tied to these limits.
  167.  
  168. With each sector holding 512 bytes of data this allows for drives no 
  169. larger than 504 MB.
  170. (1024 X 16 X 63 = 1,032,192 sectors X 512 = 528,482,304 bytes)
  171.  
  172. To understand this limit, we have to examine how hard drives are 
  173. accessed by a PC.
  174.  
  175. Primarily, I/O commands are sent to the controller via a range of 
  176. reserved port addresses.  This is a very complicated and tedious  
  177. process and the ROM BIOS includes a subroutine (INT 13) to perform 
  178. these tasks for you. The DOS operating system then has certain 
  179. functions that further simplify the process.   They include INT 25/26 
  180. functions to read and write absolute sectors to the drive as well as 
  181. higher level functions (INT 21) to Open files, Close files, Write data 
  182. to files, etc. Most programs rely on these DOS functions to control 
  183. access to hard drives and DOS in turn calls the INT 13 BIOS 
  184. subroutines which do the actual I/O commands.
  185.  
  186. All of these subroutines are assembly language code that are  loaded 
  187. into memory from either your BIOS chip(s) or Operating System files at 
  188. startup.
  189.  
  190. Assembly language routines store and manipulate values in registers 
  191. within the CPU.  The lowest common denominator for INTEL based PC's is 
  192. 16 bit registers.  Any program or routine that wants to be backward 
  193. compatible, must use these base registers whether run on an 8088 or a 
  194. Pentium.  This basic INT 13 is the backbone of PC compatibility and 
  195. uses 16 bit registers in the following way:
  196.  
  197.    DX - 8 bits for head number - 8 bits for drive number
  198.    CX - 10 bits for cylinder number and 6 bits for sector number
  199.  
  200. The largest 10 bit number possible is 1023 hence the limit on cylinder 
  201. numbers (from 0-1023) and the largest 6 bit number is 63 (from 1-63) 
  202. allowing 63 sectors per track. 
  203.  
  204. But note - the DX register allows a maximum of 255 heads, not the 16 
  205. that original specifications called for.  This is what allows various 
  206. translation schemes to deal with drives up to 8 GB while remaining INT 
  207. 13 compatible. 
  208.  
  209. If the DX register allows 8 bits for drive number, shouldn't it be 
  210. able to control 255 drives instead of only two?
  211.  
  212. When the INT 13 sends commands to your controller, it must know the 
  213. physical geometry of the drive in question.  During initialization of 
  214. the PC, values for disk types are read from CMOS and stored into an 
  215. area of RAM called the BIOS DATA AREA.  Pointers to those entries are 
  216. stored in the Interrupt Vector Table (at addresses 0:104h and 0:118h). 
  217. The table only reserved pointers for two drives, so even if your CMOS 
  218. held more values, the standard routines wouldn't know how to deal with 
  219. them. 
  220.  
  221. Why were the INT 13 routines so limited?  They were written at a time 
  222. when 10 and 20 MB drives were the norm, and 120 MB was unbelievable.
  223. They were designed to communicate with a specific controller 
  224. interface, the ST412/506 standard (WD1003 controller), and the specs 
  225. for passing parameters included only 10 bits for cylinders number, 4 
  226. bits for head number and a single bit for drive number. 
  227.  
  228. Some of these limitations have been overcome in the past by replacing 
  229. the PC's INT 13 sub- routines with code that could recognize and deal 
  230. with different devices. That's why virtually all SCSI adapter cards 
  231. include a ROM chip and you must set the drive type to ZERO.  In 
  232. effect, no standard drives installed for the motherboard BIOS to 
  233. control. 
  234.  
  235. NetWare and other advanced Operating Systems use the drive type only 
  236. long enough to boot- up and then replace the INT 13 code with their 
  237. own device drivers.  You then need to load a different .DSK file 
  238. written specifically for each type of controller. 
  239.  
  240. In the past couple of years, many motherboard and controller BIOS's 
  241. have been enhanced to deal with ever increasing demands, but the 
  242. process of establishing new standards has led to continuing confusion 
  243. and compatibility problems.
  244.  
  245. ========================================================================
  246.                           END OF CHAPTER 1  
  247. ========================================================================
  248.  
  249. COMING SOON - CHAPTER 2 - Inside Hard Drives and Controllers :
  250.                         - Parts and Components
  251.                         - also suggestions for must reading material
  252.  
  253. ========================================================================
  254. NOTICES & PERSONAL RANTS :
  255. ========================================================================
  256.  
  257. INTERNET APOLOGIES : The original artiticle, offering this booklet, was 
  258. posted Jan. 29, 1995.  I have had lots of replies, BUT - all kinds of 
  259. people insist on replying by follow-up articles instead of private 
  260. Mail.  This proved downright embarrassing! I only wanted E-MAIL 
  261. responses.  Sorry for the clutter!
  262.  
  263. DISTRIBUTION : Chapters 1-2 will be sent by E-Mail to some 2,700 
  264. people who requested it and is being posted to various News groups. 
  265. The work to maintain a mailing list is much more trouble than it's 
  266. worth, therefore - future chapters will be posted to a select number of 
  267. New Groups and Bulletin Boards. 
  268.  
  269. Files can be obtained by ftp.  Look for "hdtech??.txt"
  270.  
  271. ftp site: archive.umich.edu in /msdos/info/disk
  272.  
  273. mirror  : wuarchive.wustl.edu in /systems/ibmpc/umich.edu/info/disk
  274.           (Note - This mirror is not always up to date)
  275.  
  276. ftp site: ftp.wi.leidenuniv.nl in /pub/faqs
  277.  
  278. Also Daniel Tauritz has a home page with links to this document plus a 
  279. number of hard drive FAQs:
  280.  
  281.           http://www.wi.leidenuniv.nl/~dtauritz/ata.html
  282.  
  283. If anyone specifically requires E-mail, send me a note with "e-mail 
  284. please" as the subject. I will be glad to accommodate them, assuming 
  285. it's a manageable number.  I cannot provide hard copy or S-Mail. 
  286.  
  287. RIGHTS : This material is copyright (C) 1992,1995 by Nicholas Majors 
  288. and Data Recovery Labs.  Feel free to distribute it as either hard 
  289. copy, electronically, or by BBS - with full copyright credit to both. 
  290.  
  291. COMMENTS & CRITICISM : I look forward to receiving suggestions, 
  292. improvements, additions, (and yes even compliments) to this material.  
  293. Please bear in mind who this has been written for - tech support 
  294. personnel, not end-users and not engineers or hardware designers.  
  295.  
  296. ========================================================================
  297.  
  298.  
  299.